home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / dominos.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  4KB  |  142 lines

  1. /***************************************************************************
  2.  
  3. Atari Dominos machine
  4.  
  5. If you have any questions about how this driver works, don't hesitate to
  6. ask.  - Mike Balfour (mab22@po.cwru.edu)
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12. static int dominos_attract = 0;
  13.  
  14. /***************************************************************************
  15. Read Ports
  16.  
  17. Dominos looks for the following:
  18.     AAAAAAAA        D                D
  19.     76543210        6                7
  20.     00011000 ($18)    n/a                Player 1 Up
  21.     00011001 ($19)    n/a                Player 1 Right
  22.     00011010 ($1A)    n/a                Player 1 Down
  23.     00011011 ($1B)    n/a                Player 1 Left
  24.  
  25.     00101000 ($28)    n/a                Player 2 Up
  26.     00101001 ($29)    n/a                Player 2 Right
  27.     00101010 ($2A)    n/a                Player 2 Down
  28.     00101011 ($2B)    n/a                Player 2 Left
  29.     00101100 ($2C)    n/a                Start 1
  30.     00101101 ($2D)    n/a                Start 2
  31.     00101110 ($2E)    n/a                Self Test
  32.  
  33.     00x10x00        Points0 (DIP)    Points1 (DIP)
  34.     00x10x01        Mode 0 $ (DIP)    Mode 1 $ (DIP)
  35.  
  36.     01xxxxxx        Coin1            Coin2
  37.  
  38. We remap our input ports because if we didn't, we'd use a bunch of ports.
  39. ***************************************************************************/
  40.  
  41. READ_HANDLER( dominos_port_r )
  42. {
  43.     switch (offset)
  44.     {
  45.         /* IN0 */
  46.         case 0x18:        return ((input_port_1_r(0) & 0x01) << 7);
  47.         case 0x19:        return ((input_port_1_r(0) & 0x02) << 6);
  48.         case 0x1A:        return ((input_port_1_r(0) & 0x04) << 5);
  49.         case 0x1B:        return ((input_port_1_r(0) & 0x08) << 4);
  50.         case 0x1C:        return ((input_port_1_r(0) & 0x10) << 3);
  51.         case 0x1D:        return ((input_port_1_r(0) & 0x20) << 2);
  52.         case 0x1E:        return ((input_port_1_r(0) & 0x40) << 1);
  53.         case 0x1F:        return ((input_port_1_r(0) & 0x80) << 0);
  54.         /* IN1 */
  55.         case 0x28:        return ((input_port_2_r(0) & 0x01) << 7);
  56.         case 0x29:        return ((input_port_2_r(0) & 0x02) << 6);
  57.         case 0x2A:        return ((input_port_2_r(0) & 0x04) << 5);
  58.         case 0x2B:        return ((input_port_2_r(0) & 0x08) << 4);
  59.         case 0x2C:        return ((input_port_2_r(0) & 0x10) << 3);
  60.         case 0x2D:        return ((input_port_2_r(0) & 0x20) << 2);
  61.         case 0x2E:        return ((input_port_2_r(0) & 0x40) << 1);
  62.         case 0x2F:        return ((input_port_2_r(0) & 0x80) << 0);
  63.         /* DSW */
  64.         case 0x10:
  65.         case 0x14:
  66.         case 0x30:
  67.         case 0x34:        return ((input_port_0_r(0) & 0x03) << 6);
  68.         case 0x11:
  69.         case 0x15:
  70.         case 0x31:
  71.         case 0x35:        return ((input_port_0_r(0) & 0x0C) << 4);
  72.         case 0x12:
  73.         case 0x16:
  74.         case 0x32:
  75.         case 0x36:        return ((input_port_0_r(0) & 0x30) << 2);
  76.         case 0x13:
  77.         case 0x17:
  78.         case 0x33:
  79.         case 0x37:        return ((input_port_0_r(0) & 0xC0) << 0);
  80.         /* Just in case */
  81.         default:        return 0xFF;
  82.     }
  83. }
  84.  
  85. /***************************************************************************
  86. Sync
  87.  
  88. When reading from SYNC:
  89.    D4 = ATTRACT
  90.    D5 = VRESET
  91.    D6 = VBLANK*
  92.    D7 = some alternating signal!?!
  93.  
  94. The only one of these I really understand is the VBLANK...
  95. ***************************************************************************/
  96. READ_HANDLER( dominos_sync_r )
  97. {
  98.         static int ac_line=0x00;
  99.  
  100.         ac_line=(ac_line+1) % 3;
  101.         if (ac_line==0)
  102.                 return ((input_port_4_r(0) & 0x7F) | dominos_attract | 0x80);
  103.         else
  104.                 return ((input_port_4_r(0) & 0x7F) | dominos_attract );
  105. }
  106.  
  107.  
  108.  
  109. /***************************************************************************
  110. Attract
  111. ***************************************************************************/
  112. WRITE_HANDLER( dominos_attract_w )
  113. {
  114.     dominos_attract = (data & 0x01) << 6;
  115. }
  116.  
  117. /***************************************************************************
  118. Lamps
  119. ***************************************************************************/
  120. WRITE_HANDLER( dominos_lamp1_w )
  121. {
  122.     /* Address Line 0 is the data passed to LAMP1 */
  123.     osd_led_w(0,offset & 0x01);
  124. }
  125.  
  126. WRITE_HANDLER( dominos_lamp2_w )
  127. {
  128.     /* Address Line 0 is the data passed to LAMP2 */
  129.     osd_led_w(1,offset & 0x01);
  130. }
  131.  
  132. /***************************************************************************
  133. Sound function
  134. ***************************************************************************/
  135. WRITE_HANDLER( dominos_tumble_w )
  136. {
  137.     /* ??? */
  138.     return;
  139. }
  140.  
  141.  
  142.